// 父类
class Parent {
    constructor(name) {
        this.name = name
    }
    eat () {
        console.log(`i am ${this.name},i can eat`)
    }
}

// 子类
class Child extends Parent {
    constructor(name, num) {
        super(name)
        this.num = num
    }
    sayHi () {
        console.log(`姓名：${this.name}，学号：${this.number}`)
    }

}

// 通过类 new 实例
const Tom = new Child("Tom", 1821)
console.log(Tom.name)
console.log(Tom.num)
Tom.sayHi()
Tom.eat()

console.log(Tom instanceof Parent) //true
console.log(Tom instanceof Child)
console.log(Tom instanceof Object)

typeof Child // function